﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace WebsiteAdmin.Salomon.Focus
{
    public partial class FocusEdit : System.Web.UI.Page
    {
        #region //所需变量
        public string dateNow = DateTime.Now.ToString("yyyy-MM-dd");
        protected int pkid = 0;            //PKID
        protected string title = "";       //标题
        protected string summary = "";     //简介
        protected string imgURL = "";      //图片路径
        protected string linkURL = "";     //链接
        protected int sortBy = -1;         //排序
        public string startDate;
        public string endDate;
        protected string strCon = "";
        #endregion

        protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack)
            {
                strCon = Global.ConSalomon;
                pkid = Convert.ToInt32(Request["pkid"]);
                InitDate(pkid, strCon);
            }
        }

        //根据pkid提取数据
        protected void InitDate(int pkid,string strCon) 
        {
            DataTable dt = new DataTable();
            dt = new Bll.FocusSlide().GetFocusByPKID(pkid,strCon);
            if (dt != null && dt.Rows.Count > 0)
            {
                title = dt.Rows[0]["FocusTitle"].ToString();
                summary = dt.Rows[0]["Summary"].ToString();
                imgURL = dt.Rows[0]["ImgURL"].ToString();
                linkURL = dt.Rows[0]["LinkURL"].ToString();
                sortBy = Convert.ToInt32(dt.Rows[0]["SortBy"].ToString());
                startDate = Convert.ToDateTime(dt.Rows[0]["StartDate"]).ToString("yyyy-MM-dd");
                endDate = Convert.ToDateTime(dt.Rows[0]["EndDate"]).ToString("yyyy-MM-dd");
            }
        }
    }
}
